class Person{

    public String name="dddd";

    public Person(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                '}';
    }
@Override
    public boolean equals(Object obj){



        Person person=(Person) obj;

        return this.name.equals(person.name);
    }


}

public class Test {

    public static void main(String[] args) {


        Person person=new Person("123");
        Person person1=new Person("123");
        System.out.println(person.equals(person1));

    }
}
